let app = new Vue({
	el : "#container",
	data:{
		getItemDetail : "",
		pageNum : 1,
		name : "",
		status: 0,
		goodsNo : 0,
	
	},
	created() {
		this.getList()
	},
	methods:{
		getList(pageNum1){
			let data = new URLSearchParams;
			if(pageNum1>0){
				this.pageNum=pageNum1;
			}
			console.log(this.getQueryString("id"));
			data.append("pageNum",this.pageNum);
			data.append("id",this.getQueryString("id"));
			data.append("goodsNo",this.goodsNo);
			data.append("status",this.status);
			data.append("pageSize",3);
			axios({
				url : "cangku/selectByItemDetail",
				method : "post",
				data : data,
				headers:{"token":localStorage.token,"url":window.location.pathname}
			}).then(response=>{
				
				this.getItemDetail = response.data.data;
				this.name=response.data.data.list[0].goodsname;
			})
		},
		getQueryString(name) {
		     return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null
		},indexSelect(event){
　　			this.status=event.target.value;
				console.log(this.status);
		},
		getStatus(){
			let data = new URLSearchParams;
			data.append("pageNum",this.pageNum);
		},
		tijiao(){
			this.getList(1);
		},
		shanchu(id){
			let data = new URLSearchParams;
			data.append("id",id);
			console.log(id);
			var mymessage=confirm("确定要删除么？");
				if(mymessage==true)
				{               
					axios({
						url : "cangku/deletById",
						method : "post",
						data : data,
						headers:{"token":localStorage.token,"url":window.location.pathname}
					}).then(response=>{
						if(response.data.data){
							alert("删除成功!");
							this.getList(1);
						}else{
							alert("删除失败!");
						}
					})
				}
				else
				{
					alert("取消操作");
				}

			
		}
	}
})